package com.leapp.sk.viewdelegate.personal

import android.text.TextUtils
import android.widget.TextView
import com.example.mvp.delegate.BaseAppDelegate
import com.example.mvp.view.SKTopBar
import com.leapp.sk.R
import com.leapp.sk.ui.activity.personal.ChangePhoneActivity
import com.leapp.sk.ui.activity.personal.PersonalDataActivity

/**
 * 更换手机视图托管类
 * @author  chaohaipeng  on 2018/8/8.
 */
class ChangePhoneDelegate : BaseAppDelegate() {
    override fun initWidget() {
    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_change_phone
    }

    /**
     * 设置手机号
     */
    fun setPhone(phone:String?){
        val tv_acp_change_phone= getView<TextView>(R.id.tv_acp_change_phone)
        if (!TextUtils.isEmpty(phone)){
            tv_acp_change_phone.text=phone
        }
    }
    /**
     * 设置手机号
     */
    fun getPhone():String{
        val tv_acp_change_phone= getView<TextView>(R.id.tv_acp_change_phone)
        val trim = tv_acp_change_phone.text.toString().trim()
      return trim
    }
    /**
     * 设置标题栏
     */
    fun setTitle(title:String?){
        val jtb_acp= getView<SKTopBar>(R.id.jtb_acp)
        if (!TextUtils.isEmpty(title)){
            jtb_acp.setTitle(title)
        }
        setEvent(jtb_acp)
    }

    /**
     * 设置设置事件
     */
    fun setEvent(topBar: SKTopBar){
        topBar?.setEventInterface(object : SKTopBar.EventInterface{
            override fun leftOnClick() {
                getActivity<ChangePhoneActivity>().finish()

            }
            override fun rightOnClick() {
            }

        })
    }
}